package charpter11.lynx;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Random;

public class TwentyFour {
	public static void main(String[] args) {
		LinkedHashMap<String, Integer> map = new LinkedHashMap<String, Integer>();
		Random rd = new Random();
		for (int i = 0; i<100; i++){
			map.put("test"+rd.nextInt(1000), rd.nextInt(1000));
		}
		
		LinkedList<String> keys = new LinkedList<String>(map.keySet());
		Collections.sort(keys);
		
		for(String entry:keys){
			int value = map.get(entry);
			map.remove(entry);
			map.put(entry, value);
		}
		System.out.println(map);
	}
}
